Skip to content

Conversation

@benthecarman
Copy link
Collaborator

@benthecarman benthecarman commented Feb 6, 2026

Adds serializers for bytevectors and enums defined in our proto files.
This makes it so we can print out something like "status": "SUCCEEDED" instead of "status": 1.

before:

₿ ldk-server-cli list-payments 
{
  "payments": [
    {
      "id": "0bfd4050d9251e9c8dc14d4f59e579a47db055f649ad093ac9f463b38fc63daf",
      "kind": {
        "kind": {
          "bolt11": {
            "hash": "0bfd4050d9251e9c8dc14d4f59e579a47db055f649ad093ac9f463b38fc63daf",
            "preimage": "69172b32ae823751d37c7485c17ebb168f165b900435370dc267e6f71e381a66",
            "secret": [
              93,
              160,
              246,
              39,
              147,
              33,
              180,
              246,
              98,
              129,
              85,
              25,
              203,
              68,
              48,
              58,
              251,
              79,
              201,
              51,
              119,
              173,
              62,
              224,
              182,
              102,
              92,
              126,
              221,
              2,
              198,
              163
            ]
          }
        }
      },
      "amount_msat": 1000000000,
      "fee_paid_msat": 0,
      "direction": 1,
      "status": 1,
      "latest_update_timestamp": 1770412903
    }
  ]
}

after:

₿ ldk-server-cli list-payments 
{
  "list": [
    {
      "id": "0bfd4050d9251e9c8dc14d4f59e579a47db055f649ad093ac9f463b38fc63daf",
      "kind": {
        "kind": {
          "bolt11": {
            "hash": "0bfd4050d9251e9c8dc14d4f59e579a47db055f649ad093ac9f463b38fc63daf",
            "preimage": "69172b32ae823751d37c7485c17ebb168f165b900435370dc267e6f71e381a66",
            "secret": "5da0f6279321b4f662815519cb44303afb4fc93377ad3ee0b6665c7edd02c6a3"
          }
        }
      },
      "amount_msat": 1000000000,
      "fee_paid_msat": 0,
      "direction": "OUTBOUND",
      "status": "SUCCEEDED",
      "latest_update_timestamp": 1770412903
    }
  ]
}

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Feb 6, 2026

👋 Thanks for assigning @tnull as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@ldk-reviews-bot
Copy link

🔔 1st Reminder

Hey @tnull! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

Copy link
Collaborator

@tnull tnull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, not the biggest fan of this approach, as it will add a lot of additional boilerplate here, that then surely will get stale/out-of-sync at some point. Do you see a way to avoid that? Could we maybe reuse some of the Server types rather than replicating them?

Adds serializers for bytevectors and enums defined in our proto files.
This makes it so we can print out something like `"status": "SUCCEEDED"` instead of `"status": 1`.
@benthecarman
Copy link
Collaborator Author

benthecarman commented Feb 9, 2026

Okay found a much better way to do this. Only downside is we have the double kind in the output because of how serde handles enums but code is much cleaner/maintainable

@benthecarman benthecarman changed the title Improve CLI output readability for payment types Add serde serializers for Bytes and Enums in protos Feb 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants